<?php
    @include_once("conn.php");

    $gid = $_GET["gid"];
    if(!$gid){
        argErr();
    }

    $sql = "select id,goodsId,goodsName,goodsPrice,bigPicList,smallPicList FROM `goodslist` where goodsId = '$gid'";

    $result = mysqli_query($conn,$sql);

    $item = mysqli_fetch_assoc($result);

    
    
    $obj = array();
    if($item){   // 有数据 
        // 数据预处理
        $item["smallPicList"] = explode(",",$item["smallPicList"]);
        $item["bigPicList"] = explode(",",$item["bigPicList"]);
        // $item["goodsImg"] =  $item["bigPicList"][0];


        $obj["status"] = true;
        $obj["detail"] = "ok";
        $obj["data"] = $item;
    }else{
        $obj["status"] = false;
        $obj["detail"] = "暂无数据";
    }

    echo json_encode($obj);

?>